//
//  BaseNavigationController.m
//  Connections
//
//  Created by beisheng03 on 2017/9/28.
//  Copyright © 2017年 beisheng. All rights reserved.
//

#import "BaseNavigationController.h"
#import "UIImageView+CornerRadius.h"

@interface BaseNavigationController ()

@end

@implementation BaseNavigationController


+ (void)initialize
{
    if (self == [BaseNavigationController class]) {
        
        UINavigationBar *gationBar = [UINavigationBar appearanceWhenContainedIn:self, nil];
        
        gationBar.tintColor = [UIColor whiteColor];
        
        NSMutableDictionary *dic = [NSMutableDictionary dictionary];
        
        dic[NSFontAttributeName] = [UIFont systemFontOfSize:20];
        dic[NSForegroundColorAttributeName] = [UIColor blackColor];
        
        [gationBar setTitleTextAttributes:dic];
        
        NSMutableDictionary *dic1 = [NSMutableDictionary dictionary];
        
        dic1[NSForegroundColorAttributeName] = [UIColor whiteColor];
        
        [gationBar setTitleTextAttributes:dic1];
        
        //        [gationBar setBackgroundImage:[UIImage imageWithColor:[UIColor colorWithRed:38.0/255.0 green:133.0/255.0  blue:216.0/255.0 alpha:0.9]] forBarMetrics:UIBarMetricsDefault];
        
        //        [gationBar setBackgroundImage:[UIImage imageNamed:@"navigationbarBackgroundWhite"] forBarMetrics:UIBarMetricsDefault];
        
        [gationBar setBackgroundImage:[UIImage imageWithMyColor:[UIColor colorWithRed:42.0/255.0 green:144.0/255.0  blue:131.0/255.0 alpha:0.98]] forBarMetrics:UIBarMetricsDefault];
        
    }
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any HomeViewControlleradditional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    // 只有非根控制器,才需要设置返回按钮
    // 0
    if (self.childViewControllers.count > 0 ) { // 非根控制器
        
        viewController.hidesBottomBarWhenPushed = YES;
        
        
    }
    
    viewController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:nil action:nil];
    
    [super pushViewController:viewController animated:animated];
}


- (UIStatusBarStyle)preferredStatusBarStyle{
    
    
    return UIStatusBarStyleLightContent;
    
}

@end
